Skip to content

feat(scouts): add cross-fleet scout findings page#3037

Merged
andrewm4894 merged 3 commits into
mainfrom
feat/scout-findings-page
Jun 30, 2026
Merged

feat(scouts): add cross-fleet scout findings page#3037
andrewm4894 merged 3 commits into
mainfrom
feat/scout-findings-page

Conversation

@andrewm4894

@andrewm4894 andrewm4894 commented Jun 30, 2026

Copy link
Copy Markdown
Member

What

Adds a Scout findings page to the Code app at /code/agents/scouts/findings, reached via a callout in the Scouts section under Agents. It ports the cloud Inbox's scouts-modal FindingsPanel (frontend/src/scenes/inbox/components/findings/FindingsPanel.tsx) so the desktop surface stays in parity.

A cross-fleet findings browser — every finding the troop emitted recently in one place:

  • Search over finding text + scout name
  • Filter by scout and by severity (P0–P4)
  • Sort by newest / oldest / severity / confidence
  • Each card shows the emitting scout and a chip linking to the inbox report its signal grouped into
  • Skeleton / empty / error states, plus a non-fatal "list may be incomplete" warning when a background refresh fails
image image

How

Reuses the existing scout data plumbing (useScoutRuns, useScoutRunEmissions, useScoutEmissionReports, ScoutEmissionCard). The runs query is cache-shared with the fleet section, so opening the page doesn't double-fetch the window. Pure join/filter/sort/summarize logic lives in @posthog/core (scoutFindings.ts) behind unit tests; the UI hook only wires queries.

New

  • packages/core/src/scouts/scoutFindings.ts — emitted-run capping, row join, filter/sort, summaries
  • packages/core/src/scouts/scoutFindings.test.ts — 15 tests
  • packages/ui/src/features/scouts/hooks/useScoutFindings.ts
  • packages/ui/src/features/scouts/components/ScoutFindingsView.tsx
  • packages/ui/src/features/scouts/components/FleetFindingsCallout.tsx
  • packages/ui/src/router/routes/code/agents/scouts.findings.tsx

Changed

  • ScoutEmissionCard.tsx — optional scoutLabel to show the emitting scout on cross-fleet cards
  • navigationBridge.tsnavigateToScoutFindings()
  • ConfigureAgentsSection.tsx — wired the callout under the fleet
  • analytics-events.tsscout_findings surface + open_findings/filter_findings/sort_findings actions
  • routeTree.gen.ts — regenerated

Testing

  • Core: 15/15 tests pass, typecheck clean, Biome lint clean (no noRestrictedImports)
  • Shared: typecheck clean
  • New UI files: typecheck + lint clean

Note: the UI package has pre-existing typecheck errors in sessions/components/chat-thread / session-update from a stale @posthog/quill install (just-merged ChatX feature) — unrelated to this PR; none are in changed files.

Port the cloud Inbox's scouts-modal FindingsPanel into the Code app as a
new page at /code/agents/scouts/findings, reached via a callout in the
Scouts section under Agents.

It lists every finding the troop emitted recently in one place,
newest-first, searchable and filterable by scout/severity with a sort
toggle (newest/oldest/severity/confidence). Each card shows the emitting
scout and a chip into the inbox report its signal grouped into.

Reuses the existing scout data plumbing (useScoutRuns/useScoutRunEmissions/
useScoutEmissionReports, ScoutEmissionCard); the runs query is cache-shared
with the fleet section so opening the page does not double-fetch. Pure
join/filter/sort logic lives in core (scoutFindings.ts) with unit tests.
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown

React Doctor found no issues in the changed files. 🎉

Reviewed by React Doctor for commit 6610ccc.

Place the Scout findings callout inside the expanded scout fleet section,
just above the scratchpad (FleetMemoryCallout) callout, instead of below
the fleet in the outer Agents section. Match its styling to the adjacent
scratchpad callout.
@andrewm4894 andrewm4894 self-assigned this Jun 30, 2026
@greptile-apps

greptile-apps Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "fix(scouts): move findings callout into ..." | Re-trigger Greptile

Comment thread packages/ui/src/features/scouts/components/ScoutFindingsView.tsx
Comment thread packages/core/src/scouts/scoutFindings.test.ts Outdated
Comment thread packages/core/src/scouts/scoutFindings.ts
Comment thread packages/core/src/scouts/scoutFindings.ts Outdated
- Stale-data warning also fires on a background runs-refetch failure
  (runsError), not just emissions errors.
- Drop superfluous .slice() before .sort() in mostRecentEmittedRuns and
  filterAndSortScoutFindings (.filter() already returns a fresh array).
- Parameterise the sort tests with it.each and add 'oldest' coverage.
@andrewm4894 andrewm4894 enabled auto-merge (squash) June 30, 2026 21:09
@andrewm4894 andrewm4894 merged commit b731312 into main Jun 30, 2026
23 checks passed
@andrewm4894 andrewm4894 deleted the feat/scout-findings-page branch June 30, 2026 21:11

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 790013afbf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

import { ScoutFindingsView } from "@posthog/ui/features/scouts/components/ScoutFindingsView";
import { createFileRoute } from "@tanstack/react-router";

export const Route = createFileRoute("/code/agents/scouts/findings")({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid shadowing the findings scout slug

When a project has a custom scout named signals-scout-findings, scoutSkillSlug strips the prefix to findings, and the existing row links build /code/agents/scouts/$skillName with that value (ScoutRowCard.tsx:72-73, scout-naming.ts:4-7). This new static route uses the same URL, so those rows/deep links route to the fleet findings page instead of the scout detail; put the fleet page under a non-conflicting segment or reserve/handle this slug explicitly.

Useful? React with 👍 / 👎.

Comment on lines +251 to +253
{hasLoadedOnce &&
emissionsError &&
emissionsFetching === false &&

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Surface stale rows when the runs refresh fails

When the page has already loaded and the runs-window poll fails (useScoutRuns.ts:24-26 refetches every 60s), React Query retains previous data, so rows.length > 0 and loadFailed is true but this warning is skipped because it only checks emissionsError. Users then see stale/incomplete cross-fleet findings with no error banner; include runsError/loadFailed in this stale-data warning.

Useful? React with 👍 / 👎.

Comment on lines +345 to +347
{isFiltering
? "No findings match your search and filters."
: "Your scouts haven't emitted any findings yet. As they scan your project, what they surface shows up here."}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Don't report missing emission details as no findings

If the runs window contains emitted runs but batchScoutRunEmissions returns no detail rows for them (the existing per-scout view explicitly handles this at ScoutSignalsSection.tsx:160-162), this page falls through to the “haven't emitted any findings yet” empty state because it only checks rows.length. That misrepresents projects where findings were emitted but details are unavailable/deleted; compare against the run-level emitted_count and show an unavailable/incomplete state instead.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants